Skip to content

Fix routing YAML best results export#1422

Open
fallintoplace wants to merge 2 commits into
NVIDIA:mainfrom
fallintoplace:fix/routing-yaml-best-results
Open

Fix routing YAML best results export#1422
fallintoplace wants to merge 2 commits into
NVIDIA:mainfrom
fallintoplace:fix/routing-yaml-best-results

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Routing YAML export used dict.update with a set when best-results settings were enabled. That raises at runtime instead of writing best_result_path and best_result_interval.

This writes those fields with normal key assignment and treats None as the only missing interval value, so an explicit interval of 0 is preserved.

Reproduction

Running the original serialization logic gives:

interval=1: ValueError: dictionary update sequence element #0 has length 16; 2 is required
interval=0: {}

With this change, both intervals serialize the configured path and interval.

Validation

  • python3 -m py_compile python/cuopt/cuopt/routing/utils.py python/cuopt/cuopt/tests/routing/test_solver_settings.py
  • pre-commit run --files python/cuopt/cuopt/routing/utils.py python/cuopt/cuopt/tests/routing/test_solver_settings.py --show-diff-on-failure
  • git diff --check

Not run locally: PYTHONPATH=python/cuopt uvx --with 'pytest<9.0' --with pyyaml --with numpy pytest python/cuopt/cuopt/tests/routing/test_solver_settings.py -k 'dump_config' -q could not collect because cudf is not installed in this local environment.

@fallintoplace
fallintoplace requested a review from a team as a code owner June 10, 2026 21:39
@fallintoplace
fallintoplace requested a review from tmckayus June 10, 2026 21:39
@copy-pr-bot

copy-pr-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates best result YAML serialization to preserve an interval of zero and adds temporary-file test coverage that parses and verifies the resulting configuration.

Changes

Best results serialization and validation

Layer / File(s) Summary
Best results YAML serialization
python/cuopt/cuopt/routing/utils.py
save_data_model_to_yaml checks best_result_interval is not None before assigning best_result_path and best_result_interval to YAML.
YAML output test validation
python/cuopt/cuopt/tests/routing/test_solver_settings.py
test_dump_config uses temporary paths, sets best result output with interval 0, parses the YAML, and verifies both serialized fields.

Estimated code review effort: 2 (Simple) | ~8 minutes

Suggested reviewers: tmckayus

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: fixing routing YAML best-results export.
Description check ✅ Passed The description accurately explains the YAML export bug, the fix, and the validation steps.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cuopt/cuopt/tests/routing/test_solver_settings.py`:
- Around line 56-58: Tests use hardcoded filenames (config_file =
"solver_cfg.yaml", best_results_file = "best_results.txt") when calling
s.dump_config_file and s.dump_best_results which can collide in parallel runs;
change to use the pytest tmp_path fixture to create per-test files/paths (e.g.,
tmp_path / "solver_cfg.yaml" and tmp_path / "best_results.txt") and pass those
Path strings to s.dump_config_file and s.dump_best_results, and apply the same
tmp_path-based replacements for the other occurrences referenced around lines
72-75 so each test writes to isolated temporary files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: aad36dbe-fcf2-4f80-ba50-bb871cf12d09

📥 Commits

Reviewing files that changed from the base of the PR and between c99a5ce and 7c734a8.

📒 Files selected for processing (2)
  • python/cuopt/cuopt/routing/utils.py
  • python/cuopt/cuopt/tests/routing/test_solver_settings.py

Comment thread python/cuopt/cuopt/tests/routing/test_solver_settings.py Outdated
@github-actions

Copy link
Copy Markdown

🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you!

If this is an "epic" issue, then please add the "epic" label to this issue.
If it is a PR and not ready for review, then please convert this to draft.
If you just want to switch off this notification, then use the "skip inactivity reminder" label.

4 similar comments
@github-actions

Copy link
Copy Markdown

🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you!

If this is an "epic" issue, then please add the "epic" label to this issue.
If it is a PR and not ready for review, then please convert this to draft.
If you just want to switch off this notification, then use the "skip inactivity reminder" label.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you!

If this is an "epic" issue, then please add the "epic" label to this issue.
If it is a PR and not ready for review, then please convert this to draft.
If you just want to switch off this notification, then use the "skip inactivity reminder" label.

@github-actions

Copy link
Copy Markdown

🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you!

If this is an "epic" issue, then please add the "epic" label to this issue.
If it is a PR and not ready for review, then please convert this to draft.
If you just want to switch off this notification, then use the "skip inactivity reminder" label.

@github-actions

Copy link
Copy Markdown

🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you!

If this is an "epic" issue, then please add the "epic" label to this issue.
If it is a PR and not ready for review, then please convert this to draft.
If you just want to switch off this notification, then use the "skip inactivity reminder" label.

@chris-maes chris-maes assigned Iroy30 and unassigned Iroy30 Jul 21, 2026
Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants